/**  
 * @Title:  XlsHandleController.java   
 * @Package com.platform.controller   
 * @Description: (用一句话描述该文件做什么)   
 * @author: <a href="mailto:15909910367@163.com">吴先生</a> 
 * @date:   2021年4月15日 下午6:24:05   
 * @version V1.0 
 * @Copyright: 2021 吴先生.
 */
package com.platform.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.platform.base.R;
import com.platform.ext.offices.poi.excel.GetExcelData;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**   
 * @ClassName:  XlsHandleController   
 * @Description:Excel操作请求
 * @author: <a href="mailto:15909910367@163.com">吴先生</a>  
 * @date:   2021年4月15日 下午6:24:05   
 *     
 * @Copyright: 2021 吴元森.  
 */
@Api(tags = "COMMON-Excel数据解析预览服务")
@Controller
@RequestMapping("excelHandler")
public class ExcelHandleController {

	@ApiOperation("解析Xls文件内容，获取sheel内容")
	@ApiImplicitParams({
        @ApiImplicitParam(name = "fileName", 		value = "导入的文件名称", required = true, dataType = "String")
	})
	@RequestMapping(name = "getSheels",method = RequestMethod.GET)
	@ResponseBody
	public R<?> getSheels(String fileName){
		return R.success(GetExcelData.getExcelSheet(fileName));
	}
	
	@ApiOperation("获取表头根据sheel名称")
	@ApiImplicitParams({
        @ApiImplicitParam(name = "fileName", 		value = "导入的文件名称", required = true, dataType = "String"),
        @ApiImplicitParam(name = "sheelName", 		value = "shell名称", required = true, dataType = "String"),
        @ApiImplicitParam(name = "titleColInLine", 	value = "表头所在行,从0开始", required = true, dataType = "int")
	})
	@RequestMapping(name = "getTitlesBySheeName",method = RequestMethod.POST)
	@ResponseBody
	public R<?> getTitlesBySheeName(String fileName,String shellName,int titleColInLine){
		return R.success(GetExcelData.getExcelTitle(fileName, shellName, titleColInLine));
	}
}
